package com.itheima.blockingqueue;

import java.util.concurrent.ArrayBlockingQueue;

/*
阻塞队列的使用
 */
public class Demo01 {

    public static void main(String[] args) throws InterruptedException {
        ArrayBlockingQueue<String> queue = new ArrayBlockingQueue<String>(3);
        //放
        queue.put("kunkun1");
        queue.put("kunkun2");
        System.out.println(queue.take());
        queue.put("kunkun3");
        queue.put("kunkun4");//当 阻塞了队列 满了时 再往进放数据   阻塞了 等着
        //取

        System.out.println(queue.take());
        System.out.println(queue.take());
        System.out.println(queue.take());
        System.out.println(queue.take());


    }

}
